//
//  iTermTerminfo.h
//  iTerm2SharedARC
//
//  Created by George Nachman on 7/16/24.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, iTermTerminfoBoolean) {
    iTermTerminfoBoolean_auto_left_margin,
    iTermTerminfoBoolean_auto_right_margin,
    iTermTerminfoBoolean_no_esc_ctlc,
    iTermTerminfoBoolean_ceol_standout_glitch,
    iTermTerminfoBoolean_eat_newline_glitch,
    iTermTerminfoBoolean_erase_overstrike,
    iTermTerminfoBoolean_generic_type,
    iTermTerminfoBoolean_hard_copy,
    iTermTerminfoBoolean_has_meta_key,
    iTermTerminfoBoolean_has_status_line,
    iTermTerminfoBoolean_insert_null_glitch,
    iTermTerminfoBoolean_memory_above,
    iTermTerminfoBoolean_memory_below,
    iTermTerminfoBoolean_move_insert_mode,
    iTermTerminfoBoolean_move_standout_mode,
    iTermTerminfoBoolean_over_strike,
    iTermTerminfoBoolean_status_line_esc_ok,
    iTermTerminfoBoolean_dest_tabs_magic_smso,
    iTermTerminfoBoolean_tilde_glitch,
    iTermTerminfoBoolean_transparent_underline,
    iTermTerminfoBoolean_xon_xoff,
    iTermTerminfoBoolean_needs_xon_xoff,
    iTermTerminfoBoolean_prtr_silent,
    iTermTerminfoBoolean_hard_cursor,
    iTermTerminfoBoolean_non_rev_rmcup,
    iTermTerminfoBoolean_no_pad_char,
    iTermTerminfoBoolean_non_dest_scroll_region,
    iTermTerminfoBoolean_can_change,
    iTermTerminfoBoolean_back_color_erase,
    iTermTerminfoBoolean_hue_lightness_saturation,
    iTermTerminfoBoolean_col_addr_glitch,
    iTermTerminfoBoolean_cr_cancels_micro_mode,
    iTermTerminfoBoolean_has_print_wheel,
    iTermTerminfoBoolean_row_addr_glitch,
    iTermTerminfoBoolean_semi_auto_right_margin,
    iTermTerminfoBoolean_cpi_changes_res,
    iTermTerminfoBoolean_lpi_changes_res,
};

typedef NS_ENUM(NSUInteger, iTermTerminfoNumber) {
    iTermTerminfoNumber_columns,
    iTermTerminfoNumber_init_tabs,
    iTermTerminfoNumber_lines,
    iTermTerminfoNumber_lines_of_memory,
    iTermTerminfoNumber_magic_cookie_glitch,
    iTermTerminfoNumber_padding_baud_rate,
    iTermTerminfoNumber_virtual_terminal,
    iTermTerminfoNumber_width_status_line,
    iTermTerminfoNumber_num_labels,
    iTermTerminfoNumber_label_height,
    iTermTerminfoNumber_label_width,
    iTermTerminfoNumber_max_attributes,
    iTermTerminfoNumber_maximum_windows,
    iTermTerminfoNumber_max_colors,
    iTermTerminfoNumber_max_pairs,
    iTermTerminfoNumber_no_color_video,
    iTermTerminfoNumber_buffer_capacity,
    iTermTerminfoNumber_dot_vert_spacing,
    iTermTerminfoNumber_dot_horz_spacing,
    iTermTerminfoNumber_max_micro_address,
    iTermTerminfoNumber_max_micro_jump,
    iTermTerminfoNumber_micro_col_size,
    iTermTerminfoNumber_micro_line_size,
    iTermTerminfoNumber_number_of_pins,
    iTermTerminfoNumber_output_res_char,
    iTermTerminfoNumber_output_res_line,
    iTermTerminfoNumber_output_res_horz_inch,
    iTermTerminfoNumber_output_res_vert_inch,
    iTermTerminfoNumber_print_rate,
    iTermTerminfoNumber_wide_char_size,
    iTermTerminfoNumber_buttons,
    iTermTerminfoNumber_bit_image_entwining,
    iTermTerminfoNumber_bit_image_type,
};

typedef NS_ENUM(NSUInteger, iTermTerminfoString) {
    iTermTerminfoString_back_tab,
    iTermTerminfoString_bell,
    iTermTerminfoString_carriage_return,
    iTermTerminfoString_change_scroll_region,
    iTermTerminfoString_clear_all_tabs,
    iTermTerminfoString_clear_screen,
    iTermTerminfoString_clr_eol,
    iTermTerminfoString_clr_eos,
    iTermTerminfoString_column_address,
    iTermTerminfoString_command_character,
    iTermTerminfoString_cursor_address,
    iTermTerminfoString_cursor_down,
    iTermTerminfoString_cursor_home,
    iTermTerminfoString_cursor_invisible,
    iTermTerminfoString_cursor_left,
    iTermTerminfoString_cursor_mem_address,
    iTermTerminfoString_cursor_normal,
    iTermTerminfoString_cursor_right,
    iTermTerminfoString_cursor_to_ll,
    iTermTerminfoString_cursor_up,
    iTermTerminfoString_cursor_visible,
    iTermTerminfoString_delete_character,
    iTermTerminfoString_delete_line,
    iTermTerminfoString_dis_status_line,
    iTermTerminfoString_down_half_line,
    iTermTerminfoString_enter_alt_charset_mode,
    iTermTerminfoString_enter_blink_mode,
    iTermTerminfoString_enter_bold_mode,
    iTermTerminfoString_enter_ca_mode,
    iTermTerminfoString_enter_delete_mode,
    iTermTerminfoString_enter_dim_mode,
    iTermTerminfoString_enter_insert_mode,
    iTermTerminfoString_enter_secure_mode,
    iTermTerminfoString_enter_protected_mode,
    iTermTerminfoString_enter_reverse_mode,
    iTermTerminfoString_enter_standout_mode,
    iTermTerminfoString_enter_underline_mode,
    iTermTerminfoString_erase_chars,
    iTermTerminfoString_exit_alt_charset_mode,
    iTermTerminfoString_exit_attribute_mode,
    iTermTerminfoString_exit_ca_mode,
    iTermTerminfoString_exit_delete_mode,
    iTermTerminfoString_exit_insert_mode,
    iTermTerminfoString_exit_standout_mode,
    iTermTerminfoString_exit_underline_mode,
    iTermTerminfoString_flash_screen,
    iTermTerminfoString_form_feed,
    iTermTerminfoString_from_status_line,
    iTermTerminfoString_init_1string,
    iTermTerminfoString_init_2string,
    iTermTerminfoString_init_3string,
    iTermTerminfoString_init_file,
    iTermTerminfoString_insert_character,
    iTermTerminfoString_insert_line,
    iTermTerminfoString_insert_padding,
    iTermTerminfoString_key_backspace,
    iTermTerminfoString_key_catab,
    iTermTerminfoString_key_clear,
    iTermTerminfoString_key_ctab,
    iTermTerminfoString_key_dc,
    iTermTerminfoString_key_dl,
    iTermTerminfoString_key_down,
    iTermTerminfoString_key_eic,
    iTermTerminfoString_key_eol,
    iTermTerminfoString_key_eos,
    iTermTerminfoString_key_f0,
    iTermTerminfoString_key_f1,
    iTermTerminfoString_key_f10,
    iTermTerminfoString_key_f2,
    iTermTerminfoString_key_f3,
    iTermTerminfoString_key_f4,
    iTermTerminfoString_key_f5,
    iTermTerminfoString_key_f6,
    iTermTerminfoString_key_f7,
    iTermTerminfoString_key_f8,
    iTermTerminfoString_key_f9,
    iTermTerminfoString_key_home,
    iTermTerminfoString_key_ic,
    iTermTerminfoString_key_il,
    iTermTerminfoString_key_left,
    iTermTerminfoString_key_ll,
    iTermTerminfoString_key_npage,
    iTermTerminfoString_key_ppage,
    iTermTerminfoString_key_right,
    iTermTerminfoString_key_sf,
    iTermTerminfoString_key_sr,
    iTermTerminfoString_key_stab,
    iTermTerminfoString_key_up,
    iTermTerminfoString_keypad_local,
    iTermTerminfoString_keypad_xmit,
    iTermTerminfoString_lab_f0,
    iTermTerminfoString_lab_f1,
    iTermTerminfoString_lab_f10,
    iTermTerminfoString_lab_f2,
    iTermTerminfoString_lab_f3,
    iTermTerminfoString_lab_f4,
    iTermTerminfoString_lab_f5,
    iTermTerminfoString_lab_f6,
    iTermTerminfoString_lab_f7,
    iTermTerminfoString_lab_f8,
    iTermTerminfoString_lab_f9,
    iTermTerminfoString_meta_off,
    iTermTerminfoString_meta_on,
    iTermTerminfoString_newline,
    iTermTerminfoString_pad_char,
    iTermTerminfoString_parm_dch,
    iTermTerminfoString_parm_delete_line,
    iTermTerminfoString_parm_down_cursor,
    iTermTerminfoString_parm_ich,
    iTermTerminfoString_parm_index,
    iTermTerminfoString_parm_insert_line,
    iTermTerminfoString_parm_left_cursor,
    iTermTerminfoString_parm_right_cursor,
    iTermTerminfoString_parm_rindex,
    iTermTerminfoString_parm_up_cursor,
    iTermTerminfoString_pkey_key,
    iTermTerminfoString_pkey_local,
    iTermTerminfoString_pkey_xmit,
    iTermTerminfoString_print_screen,
    iTermTerminfoString_prtr_off,
    iTermTerminfoString_prtr_on,
    iTermTerminfoString_repeat_char,
    iTermTerminfoString_reset_1string,
    iTermTerminfoString_reset_2string,
    iTermTerminfoString_reset_3string,
    iTermTerminfoString_reset_file,
    iTermTerminfoString_restore_cursor,
    iTermTerminfoString_row_address,
    iTermTerminfoString_save_cursor,
    iTermTerminfoString_scroll_forward,
    iTermTerminfoString_scroll_reverse,
    iTermTerminfoString_set_attributes,
    iTermTerminfoString_set_tab,
    iTermTerminfoString_set_window,
    iTermTerminfoString_tab,
    iTermTerminfoString_to_status_line,
    iTermTerminfoString_underline_char,
    iTermTerminfoString_up_half_line,
    iTermTerminfoString_init_prog,
    iTermTerminfoString_key_a1,
    iTermTerminfoString_key_a3,
    iTermTerminfoString_key_b2,
    iTermTerminfoString_key_c1,
    iTermTerminfoString_key_c3,
    iTermTerminfoString_prtr_non,
    iTermTerminfoString_char_padding,
    iTermTerminfoString_acs_chars,
    iTermTerminfoString_plab_norm,
    iTermTerminfoString_key_btab,
    iTermTerminfoString_enter_xon_mode,
    iTermTerminfoString_exit_xon_mode,
    iTermTerminfoString_enter_am_mode,
    iTermTerminfoString_exit_am_mode,
    iTermTerminfoString_xon_character,
    iTermTerminfoString_xoff_character,
    iTermTerminfoString_ena_acs,
    iTermTerminfoString_label_on,
    iTermTerminfoString_label_off,
    iTermTerminfoString_key_beg,
    iTermTerminfoString_key_cancel,
    iTermTerminfoString_key_close,
    iTermTerminfoString_key_command,
    iTermTerminfoString_key_copy,
    iTermTerminfoString_key_create,
    iTermTerminfoString_key_end,
    iTermTerminfoString_key_enter,
    iTermTerminfoString_key_exit,
    iTermTerminfoString_key_find,
    iTermTerminfoString_key_help,
    iTermTerminfoString_key_mark,
    iTermTerminfoString_key_message,
    iTermTerminfoString_key_move,
    iTermTerminfoString_key_next,
    iTermTerminfoString_key_open,
    iTermTerminfoString_key_options,
    iTermTerminfoString_key_previous,
    iTermTerminfoString_key_print,
    iTermTerminfoString_key_redo,
    iTermTerminfoString_key_reference,
    iTermTerminfoString_key_refresh,
    iTermTerminfoString_key_replace,
    iTermTerminfoString_key_restart,
    iTermTerminfoString_key_resume,
    iTermTerminfoString_key_save,
    iTermTerminfoString_key_suspend,
    iTermTerminfoString_key_undo,
    iTermTerminfoString_key_sbeg,
    iTermTerminfoString_key_scancel,
    iTermTerminfoString_key_scommand,
    iTermTerminfoString_key_scopy,
    iTermTerminfoString_key_screate,
    iTermTerminfoString_key_sdc,
    iTermTerminfoString_key_sdl,
    iTermTerminfoString_key_select,
    iTermTerminfoString_key_send,
    iTermTerminfoString_key_seol,
    iTermTerminfoString_key_sexit,
    iTermTerminfoString_key_sfind,
    iTermTerminfoString_key_shelp,
    iTermTerminfoString_key_shome,
    iTermTerminfoString_key_sic,
    iTermTerminfoString_key_sleft,
    iTermTerminfoString_key_smessage,
    iTermTerminfoString_key_smove,
    iTermTerminfoString_key_snext,
    iTermTerminfoString_key_soptions,
    iTermTerminfoString_key_sprevious,
    iTermTerminfoString_key_sprint,
    iTermTerminfoString_key_sredo,
    iTermTerminfoString_key_sreplace,
    iTermTerminfoString_key_sright,
    iTermTerminfoString_key_srsume,
    iTermTerminfoString_key_ssave,
    iTermTerminfoString_key_ssuspend,
    iTermTerminfoString_key_sundo,
    iTermTerminfoString_req_for_input,
    iTermTerminfoString_key_f11,
    iTermTerminfoString_key_f12,
    iTermTerminfoString_key_f13,
    iTermTerminfoString_key_f14,
    iTermTerminfoString_key_f15,
    iTermTerminfoString_key_f16,
    iTermTerminfoString_key_f17,
    iTermTerminfoString_key_f18,
    iTermTerminfoString_key_f19,
    iTermTerminfoString_key_f20,
    iTermTerminfoString_key_f21,
    iTermTerminfoString_key_f22,
    iTermTerminfoString_key_f23,
    iTermTerminfoString_key_f24,
    iTermTerminfoString_key_f25,
    iTermTerminfoString_key_f26,
    iTermTerminfoString_key_f27,
    iTermTerminfoString_key_f28,
    iTermTerminfoString_key_f29,
    iTermTerminfoString_key_f30,
    iTermTerminfoString_key_f31,
    iTermTerminfoString_key_f32,
    iTermTerminfoString_key_f33,
    iTermTerminfoString_key_f34,
    iTermTerminfoString_key_f35,
    iTermTerminfoString_key_f36,
    iTermTerminfoString_key_f37,
    iTermTerminfoString_key_f38,
    iTermTerminfoString_key_f39,
    iTermTerminfoString_key_f40,
    iTermTerminfoString_key_f41,
    iTermTerminfoString_key_f42,
    iTermTerminfoString_key_f43,
    iTermTerminfoString_key_f44,
    iTermTerminfoString_key_f45,
    iTermTerminfoString_key_f46,
    iTermTerminfoString_key_f47,
    iTermTerminfoString_key_f48,
    iTermTerminfoString_key_f49,
    iTermTerminfoString_key_f50,
    iTermTerminfoString_key_f51,
    iTermTerminfoString_key_f52,
    iTermTerminfoString_key_f53,
    iTermTerminfoString_key_f54,
    iTermTerminfoString_key_f55,
    iTermTerminfoString_key_f56,
    iTermTerminfoString_key_f57,
    iTermTerminfoString_key_f58,
    iTermTerminfoString_key_f59,
    iTermTerminfoString_key_f60,
    iTermTerminfoString_key_f61,
    iTermTerminfoString_key_f62,
    iTermTerminfoString_key_f63,
    iTermTerminfoString_clr_bol,
    iTermTerminfoString_clear_margins,
    iTermTerminfoString_set_left_margin,
    iTermTerminfoString_set_right_margin,
    iTermTerminfoString_label_format,
    iTermTerminfoString_set_clock,
    iTermTerminfoString_display_clock,
    iTermTerminfoString_remove_clock,
    iTermTerminfoString_create_window,
    iTermTerminfoString_goto_window,
    iTermTerminfoString_hangup,
    iTermTerminfoString_dial_phone,
    iTermTerminfoString_quick_dial,
    iTermTerminfoString_tone,
    iTermTerminfoString_pulse,
    iTermTerminfoString_flash_hook,
    iTermTerminfoString_fixed_pause,
    iTermTerminfoString_wait_tone,
    iTermTerminfoString_user0,
    iTermTerminfoString_user1,
    iTermTerminfoString_user2,
    iTermTerminfoString_user3,
    iTermTerminfoString_user4,
    iTermTerminfoString_user5,
    iTermTerminfoString_user6,
    iTermTerminfoString_user7,
    iTermTerminfoString_user8,
    iTermTerminfoString_user9,
    iTermTerminfoString_orig_pair,
    iTermTerminfoString_orig_colors,
    iTermTerminfoString_initialize_color,
    iTermTerminfoString_initialize_pair,
    iTermTerminfoString_set_color_pair,
    iTermTerminfoString_set_foreground,
    iTermTerminfoString_set_background,
    iTermTerminfoString_change_char_pitch,
    iTermTerminfoString_change_line_pitch,
    iTermTerminfoString_change_res_horz,
    iTermTerminfoString_change_res_vert,
    iTermTerminfoString_define_char,
    iTermTerminfoString_enter_doublewide_mode,
    iTermTerminfoString_enter_draft_quality,
    iTermTerminfoString_enter_italics_mode,
    iTermTerminfoString_enter_leftward_mode,
    iTermTerminfoString_enter_micro_mode,
    iTermTerminfoString_enter_near_letter_quality,
    iTermTerminfoString_enter_normal_quality,
    iTermTerminfoString_enter_shadow_mode,
    iTermTerminfoString_enter_subscript_mode,
    iTermTerminfoString_enter_superscript_mode,
    iTermTerminfoString_enter_upward_mode,
    iTermTerminfoString_exit_doublewide_mode,
    iTermTerminfoString_exit_italics_mode,
    iTermTerminfoString_exit_leftward_mode,
    iTermTerminfoString_exit_micro_mode,
    iTermTerminfoString_exit_shadow_mode,
    iTermTerminfoString_exit_subscript_mode,
    iTermTerminfoString_exit_superscript_mode,
    iTermTerminfoString_exit_upward_mode,
    iTermTerminfoString_micro_column_address,
    iTermTerminfoString_micro_down,
    iTermTerminfoString_micro_left,
    iTermTerminfoString_micro_right,
    iTermTerminfoString_micro_row_address,
    iTermTerminfoString_micro_up,
    iTermTerminfoString_order_of_pins,
    iTermTerminfoString_parm_down_micro,
    iTermTerminfoString_parm_left_micro,
    iTermTerminfoString_parm_right_micro,
    iTermTerminfoString_parm_up_micro,
    iTermTerminfoString_select_char_set,
    iTermTerminfoString_set_bottom_margin,
    iTermTerminfoString_set_bottom_margin_parm,
    iTermTerminfoString_set_left_margin_parm,
    iTermTerminfoString_set_right_margin_parm,
    iTermTerminfoString_set_top_margin,
    iTermTerminfoString_set_top_margin_parm,
    iTermTerminfoString_start_bit_image,
    iTermTerminfoString_start_char_set_def,
    iTermTerminfoString_stop_bit_image,
    iTermTerminfoString_stop_char_set_def,
    iTermTerminfoString_subscript_characters,
    iTermTerminfoString_superscript_characters,
    iTermTerminfoString_these_cause_cr,
    iTermTerminfoString_zero_motion,
    iTermTerminfoString_char_set_names,
    iTermTerminfoString_key_mouse,
    iTermTerminfoString_mouse_info,
    iTermTerminfoString_req_mouse_pos,
    iTermTerminfoString_get_mouse,
    iTermTerminfoString_set_a_foreground,
    iTermTerminfoString_set_a_background,
    iTermTerminfoString_pkey_plab,
    iTermTerminfoString_device_type,
    iTermTerminfoString_code_set_init,
    iTermTerminfoString_set0_des_seq,
    iTermTerminfoString_set1_des_seq,
    iTermTerminfoString_set2_des_seq,
    iTermTerminfoString_set3_des_seq,
    iTermTerminfoString_set_lr_margin,
    iTermTerminfoString_set_tb_margin,
    iTermTerminfoString_bit_image_repeat,
    iTermTerminfoString_bit_image_newline,
    iTermTerminfoString_bit_image_carriage_return,
    iTermTerminfoString_color_names,
    iTermTerminfoString_define_bit_image_region,
    iTermTerminfoString_end_bit_image_region,
    iTermTerminfoString_set_color_band,
    iTermTerminfoString_set_page_length,
    iTermTerminfoString_display_pc_char,
    iTermTerminfoString_enter_pc_charset_mode,
    iTermTerminfoString_exit_pc_charset_mode,
    iTermTerminfoString_enter_scancode_mode,
    iTermTerminfoString_exit_scancode_mode,
    iTermTerminfoString_pc_term_options,
    iTermTerminfoString_scancode_escape,
    iTermTerminfoString_alt_scancode_esc,
    iTermTerminfoString_enter_horizontal_hl_mode,
    iTermTerminfoString_enter_left_hl_mode,
    iTermTerminfoString_enter_low_hl_mode,
    iTermTerminfoString_enter_right_hl_mode,
    iTermTerminfoString_enter_top_hl_mode,
    iTermTerminfoString_enter_vertical_hl_mode,
    iTermTerminfoString_set_a_attributes,
    iTermTerminfoString_set_pglen_inch,
};

@interface iTermTerminfo : NSObject
@property (nonatomic, readonly) NSString *term;
@property (nonatomic, readonly) NSDictionary<NSString *, id> *database;
@property (nonatomic, readonly) BOOL isValid;

+ (instancetype)forTerm:(NSString *)term;
- (instancetype)init NS_UNAVAILABLE;

- (NSNumber * _Nullable)booleanForKey:(iTermTerminfoBoolean)key;
- (NSNumber * _Nullable)numberForKey:(iTermTerminfoNumber)key;
- (NSString * _Nullable)stringForKey:(iTermTerminfoString)key;
- (id _Nullable)objectForStringKey:(NSString *)key;
- (NSString * _Nullable)stringForStringKey:(NSString *)key;

@end

NS_ASSUME_NONNULL_END
